/**
	// 弹出聊天界面
 用法 chat(imUsername, nickname,lat, lng, address)
  */
	export default chat
	
	function chat (imUsername, nickname, lat, lng, address) {
		// console.log('chat---imUsername', imUsername, nickname)
		if (uni.getSystemInfoSync().platform == 'android') {
			// 极光聊天室二次封装
			const dcRichAlert = uni.requireNativePlugin('ZWM-BJXMapView');
			// 弹出聊天界面
			return dcRichAlert.showChatViewController({
				lat: lat,
				lng: lng,
				address: address,
				username: imUsername,
				TARGET_NICKNAME: nickname,
				TARGET_APP_KEY:'6d3c21662373e17b01f9b169',
			}, result => { 
				console.log('安卓點頭像回調',result)
				let id = result.result.replace('zlg_', '')
				console.log('~~~~~id', id)
				//0 雇员，1雇主
				// 点自己头像
				if (id == uni.getStorageSync('userId')) {
					if(uni.getStorageSync('userType')) {
						uni.navigateTo({ url: '/pages/employer-detail/employer-detail?bossId=' + id })//雇主
					}else {
						uni.navigateTo({ url: '/pages/employer-detail/employee-detail?staffId=' + id})
					}
				}else {
					// 点对方头像
					if(uni.getStorageSync('userType')) {
						uni.navigateTo({ url: '/pages/employer-detail/employee-detail?staffId=' + id})
					}else {
						uni.navigateTo({ url: '/pages/employer-detail/employer-detail?bossId=' + id })//僱主
					}
				}
			})
		}else {
			console.log('chat---苹果',imUsername, nickname)
			const dcJobAlert = uni.requireNativePlugin('ZWM-BJXJobView');
			dcJobAlert.testSyncFunc({ 
				lat: lat,
				lng: lng,
				address: address,
				username: imUsername
			}, result => { 
				console.log('蘋果點頭像回調',result)
				let id = result.result.replace('zlg_', '')
				console.log('~~~~~id', id)
				//0 雇员，1雇主
				// 点自己头像
				if (id == uni.getStorageSync('userId')) {
					if(uni.getStorageSync('userType')) {
						uni.navigateTo({ url: '/pages/employer-detail/employer-detail?bossId=' + id })//雇主
					}else {
						uni.navigateTo({ url: '/pages/employer-detail/employee-detail?staffId=' + id})
					}
				}else {
					// 点对方头像
					if(uni.getStorageSync('userType')) {
						uni.navigateTo({ url: '/pages/employer-detail/employee-detail?staffId=' + id})
					}else {
						uni.navigateTo({ url: '/pages/employer-detail/employer-detail?bossId=' + id })//僱主
					}
				}
				
			})
		}
		
	}